const express = require("express");
const router = express.Router();
const aiPersonImageController = require("../controllers/AiPersionImage");
const { verifyVisitorToken } = require("../middlewares/authMiddleware");

// 调试中间件
router.use((req, res, next) => {
  console.log(
    `[ROUTE DEBUG] ${req.method} ${
      req.originalUrl
    } - ${new Date().toISOString()}`
  );
  next();
});

// 获取用户生成的AI图片 - 需要认证
router.post(
  "/user-images",
  verifyVisitorToken,
  aiPersonImageController.getUserGeneratedImages
);

// 获取具体人设生成的图片
router.post(
  "/getAicollection",
  verifyVisitorToken,
  aiPersonImageController.getAicollection
);

// 删除图片生成任务(支持单个或批量删除)
router.post(
  "/delete-images",
  verifyVisitorToken,
  aiPersonImageController.deleteImageTasks
);

module.exports = router;
